package com.example.administrator.kotlin.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.administrator.kotlin.R
import com.example.administrator.kotlin.bean.MultiBean
import com.lzy.okgo.db.CookieManager.init

/**
 * Created by Administrator on 2018/3/2/002.
 */
class MultiAdapter(initData: ArrayList<MultiBean>) : BaseMultiItemQuickAdapter<MultiBean, BaseViewHolder>(initData) {

    init {
        addItemType(MultiBean.TEXT, R.layout.item_multi_text)
        addItemType(MultiBean.IMAGE, R.layout.item_multi_image)
        addItemType(MultiBean.TEXT_IMAGE, R.layout.item_multi_text_image)
    }

    override fun convert(holder: BaseViewHolder, item: MultiBean?) {
        when (holder.itemViewType) {
            MultiBean.TEXT -> holder.setText(R.id.tv_multi_content, item?.content)
            MultiBean.TEXT_IMAGE -> holder.setText(R.id.tv_multi_text_content, item?.content)
        }
    }

}